package com.handong.handserialprogram.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2016/12/19.
 */

public class MissionDB extends SQLiteOpenHelper{

    public static final String NAME = "MissionDB";
    public static final int VERSION = 1;

    public static final String MISSION_TABLE = "Mission";

    public static final String ID = "id";
    public static final String TITLE = "title";
    public static final String START_DATE = "startDate";
    public static final String END_DATE = "endDate";
    public static final String START_POSITION = "startPosition";
    public static final String END_POSITION = "endPosition";
    public static final String CAR_ID = "escortCarId";
    public static final String DESCRIPTION = "description";
    public static final String ROUTE_ID = "planningRouteId";
    public static final String STATUS = "state";

    public static final String PERSON_TABLE = "Person";

    public static final String PERSON_ID = "personID";
    public static final String MISSION_ID = "missionID";
    public static final String EQUIPMENT_ID = "equipmentId";
    public static final String PERSON_NAME = "pName";

    //创建任务表。
    public static final String SQL_TABLE_MISSION = "create table if not exists Mission ("
            +"_id integer primary key autoincrement, "
            +"missionID varchar(5), "
            +"title varchar(20), "
            +"startDate varchar(20), "
            +"endDate varchar(20), "
            +"startPosition varchar(20), "
            +"endPosition varchar(20), "
            +"escortCarId varchar(20), "
            +"description varchar(20), "
            +"planningRouteId varchar(20), "
            +"state varchar(5))";

    public static final String TABLE_PERSON = "create table if not exists Person ("
            +"_id integer primary key autoincrement, "
            +"personId varchar(5), "
            +"escortMissionId varchar(20), "
            +"equipmentId varchar(20), "
            +"createTime varchar(20), "
            +"pName varchar(10))";

    public MissionDB(Context context) {
        super(context, NAME, null, VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(SQL_TABLE_MISSION);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
